﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XCommunity.Views;
using XCommunity.Users;
using XCommunity.Frames;
using XCommunity.Forums.Views;

namespace XCommunity.Blogs.Views
{
  public class ProfilerViewService : ViewService
  {

    public ProfilerViewService( BlogSystem blogSystem )
      : base( blogSystem.Context )
    {
      BlogSystem = blogSystem;
    }

    public BlogSystem BlogSystem
    {
      get;
      private set;
    }


    public override ICommunitySystem CommunitySystem
    {
      get { return BlogSystem; }
    }


    public IEnumerable<TopicItemView> GetAttatchedTopics()
    {
      return UserProfiler.GetAttachedTopics().Select( topicId => GetTopicItemView( topicId ) );
    }

    public TopicItemView GetTopicItemView( int topicId )
    {
      return new TopicItemView( this, GetTopicFrame( topicId ) );
    }

    protected ITopicFrame GetTopicFrame( int topicId )
    {
      return BlogSystem.Context.FrameService.GetTopicFrame( topicId );
    }

  }
}
